package com.huawei.crm.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.Valid;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@TableName("employee")
@Valid
public class Employee extends BaseEntity {

    @TableId(type = IdType.AUTO)
    private Long id;

    private String name;

    @NotBlank(message = "密码不能为空")
    private String password;

    private String email;

    @Digits(integer = 3, fraction = 2, message = "数字类型不正确")
    @Max(value = 220, message = "最大不能超过220")
    private Integer age;

    private boolean admin = false;

    //多对一的关系
    private Department dept;

    //多对多的关系
    private List<Role> roles;

}